const plugin = require('../plugins/qq');

async function run() {
  // 搜索歌曲
  const musicRes = await plugin.search('七里香', 1, 'music');
  console.log('Music Search:', musicRes);

  if (musicRes?.data?.length > 0) {
    const musicItem = musicRes.data[0];

    // 获取音源（标准音质）
    const sourceResult = await plugin.getMediaSource(musicItem, 'standard');
    console.log('Media Source:', sourceResult);

    // 获取歌词
    const lyricResult = await plugin.getLyric(musicItem);
    console.log('Lyric:', lyricResult);
  }

  // 搜索专辑并获取专辑详情（歌曲列表）
  const albumRes = await plugin.search('周杰伦', 1, 'album');
  console.log('Album Search:', albumRes);

  if (albumRes?.data?.length > 0) {
    const albumItem = albumRes.data[0];
    const albumInfo = await plugin.getAlbumInfo(albumItem);
    console.log('Album Info:', albumInfo);
  }

  // 搜索歌手并获取作品（歌曲 + 专辑）
  const artistRes = await plugin.search('周杰伦', 1, 'artist');
  console.log('Artist Search:', artistRes);

  if (artistRes?.data?.length > 0) {
    const artistItem = artistRes.data[0];
    const artistSongs = await plugin.getArtistWorks(artistItem, 1, 'music');
    console.log('Artist Songs:', artistSongs);

    const artistAlbums = await plugin.getArtistWorks(artistItem, 1, 'album');
    console.log('Artist Albums:', artistAlbums);
  }

  // 演示从歌单链接导入（示例 ID，可能无数据）
  const sheet = await plugin.importMusicSheet('https://y.qq.com/n/ryqq/playlist/123456');
  console.log('Imported Sheet:', sheet);
}

run();